//
//  NSObject+Identifier.h
//  OCPopular
//
//  Created by Jarvis on 2024/5/31.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (Identifier)

// 对象的唯一标识，默认nil
@property (nonatomic, copy  ) NSString *identifier;
// 父对象
@property (nonatomic, weak  ) NSObject *superobject;
// 子对象
@property (nonatomic, strong, readonly) NSMutableArray<__kindof NSObject *> *subobjects;

- (void)attachObject:(__kindof NSObject *)object;
- (void)detachObject:(__kindof NSObject *)object;
- (void)detachFromSuperObject;
- (__kindof NSObject *)findObjectByIdentifier:(NSString *)identifier;

@end

NS_ASSUME_NONNULL_END
